package design.cglibProxy;

import org.springframework.cglib.proxy.MethodInterceptor;
import org.springframework.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

public class HelloMethodInterceptor implements MethodInterceptor {
    @Override
    public Object intercept(Object target, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
        System.out.println("intercept before " + method.getName());
        Object res = methodProxy.invokeSuper(target, args);
        System.out.println("intercept after " + method.getName());
        return res;
    }
}
